//
//  DetailController.swift
//  HttpStydu
//
//  Created by yongkang on 2017/8/11.
//  Copyright © 2017年 sheng. All rights reserved.
//

import UIKit
import WebKit

class DetailController: UIViewController {
    
    var url: String?

    override func viewDidLoad() {
        super.viewDidLoad()
        
        print("url---->  \(self.url!)")
        
        self.view.backgroundColor = UIColor.white
        
        let conf = WKWebViewConfiguration()
        conf.preferences.javaScriptEnabled = true
        conf.preferences.javaScriptCanOpenWindowsAutomatically = true
        
        //获取状态栏高度
        let statusHeight = UIApplication.shared.statusBarFrame.height - 20
        let frame = CGRect(x:0, y:statusHeight, width:UIScreen.main.bounds.width, height:UIScreen.main.bounds.height)
        let webView:WKWebView = WKWebView(frame:frame,configuration:conf)
        
        let url = NSURL(string: self.url!)
        let request = URLRequest(url: url! as URL)
        webView.load(request)
        
        //加载页面
        webView.load(request)
        self.view.addSubview(webView)
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
}
